package br.ufpb.sistcomp.activity;

import android.app.Activity;
import android.os.Bundle;
import br.ufpb.sistcomp.R;
import br.ufpb.sistcomp.util.Message;


public class MainActivity extends Activity {
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
//		
//		try{
//			FacadeDatabase facadeDatabase = new FacadeDatabase(
//					getApplicationContext());
//			facadeDatabase.createDatabaseAndTables();
//			
//			Teacher teacher = new Teacher("Diego","diego@diegosousa.com","3422-1048","3422-1048");
//			Teacher teacher2 = new Teacher("Diego2","2diego@diegosousa.com","3421-1048","3421-1048");
//			Teacher teacher3 = new Teacher("Diego3","3diego@diegosousa.com","33422-1048","33422-1048");			
//			Semester semester = new Semester("2008.1");
//			Semester semester2 = new Semester("2009.1");
//			Semester semester3 = new Semester("2010.1");			
//			Discipline discipline = new Discipline("Calculo1","10:00");
//			Discipline discipline2 = new Discipline("Calculo2","10:00");
//			Discipline discipline3 = new Discipline("Matematica","10:00");
//			
//			
//			TeacherPersistence teacherPersistence = TeacherPersistence.getInstance(getApplicationContext());
//			SemesterPersistence semesterPersistence = SemesterPersistence.getInstance(getApplicationContext());
//			DisciplinePersistence disciplinePersistence = DisciplinePersistence.getInstance(getApplicationContext());
//			PointPersistence pointPersistence = PointPersistence.getInstance(getApplicationContext());			
//			
//			teacherPersistence.insertTeacher(teacher);
//			teacherPersistence.insertTeacher(teacher2);			
//			teacherPersistence.insertTeacher(teacher3);
//			
//			semesterPersistence.insertSemester(semester);
//			semesterPersistence.insertSemester(semester2);
//			semesterPersistence.insertSemester(semester3);
//			
//			disciplinePersistence.insertDiscipline(discipline, teacher, semester);					
//			disciplinePersistence.insertDiscipline(discipline2, teacher2, semester2);		
//			disciplinePersistence.insertDiscipline(discipline3, teacher3, semester3);
			
//			pointPersistence.insertPoint(discipline3, 7.2);
//			pointPersistence.insertPoint(discipline3, 7.2);
//			pointPersistence.insertPoint(discipline3, 7.2);
//			pointPersistence.insertPoint(discipline3, 6.2);
//			pointPersistence.insertPoint(discipline2, 2.0);
							
//			teacherPersistence.removeTeacher("Diego");
//			pointPersistence.removePoint(discipline3, 7.2);
//			semesterPersistence.removeSemester("2008.1");
//			disciplinePersistence.removeDisciplines("Calculo1");
			
			
//			semesterPersistence.insertSemester(semester);
			
	//		pointPersistence.insertPoint(discipline3, 0.0);
			
			//teacherPersistence.updateTeacher(teacher4);
			
//			facadeDatabase.closeDatabase();
//		}
//			catch(Exception e){
//				
//			}finally{
//				Message.displayMessage("Banco", "Banco criado com sucesso!", MainActivity.this);
//			}
//			
//		}						
		
//		/*
//		 * Test DataBase.
//		 */
//
//		 FacadeDatabase facadeDatabase = new FacadeDatabase(getApplicationContext());
//		 facadeDatabase.createDatabaseAndTables();
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_DELETE_ALL_TABLE);
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_CREATE_TABLE_DISCIPLINES);
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_CREATE_TABLE_POINTS);
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_CREATE_TABLE_SEMESTERS);
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_CREATE_TABLE_TEACHERS);
//		
//		
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_DELETE_TABLE_DISCIPLINES);
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_DELETE_TABLE_POINTS);
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_DELETE_TABLE_SEMESTERS);
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_DELETE_TABLE_TEACHERS);
//		
//		 facadeDatabase.runScript(InformationDatabase.SCRIPT_CREATE_ALL_TABLE);
//		
//		 facadeDatabase.closeDatabase();

		}
}


